<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="https://cdn.jsdelivr.net/npm/echarts@5.2.1/dist/echarts.js"></script>
</head>
<body>
<!--div-->
<div id="main" style="width: 600px;height:400px;"></div>
<script src="myO.js"></script>
<script type="text/javascript">
  // 基于准备好的dom，初始化echarts实例
  var myChart = echarts.init(document.getElementById('main'));

  let res_log_n = [];
  let res_n = [];
  for (let i = 1; i < 512; i *= 2) {
    res_log_n.push({index: i, res: myOLogN(i)});
    res_n.push({index: i, res: myON(i)});
  }

  // 指定图表的配置项和数据
  let option = {
    xAxis: {
      type: 'category',
      data: [...res_log_n.map(item => item.index)]
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        data: [...res_log_n.map(item => item.res)],
        type: 'line',
        smooth: true
      }, {
        data: [...res_n.map(item => item.res)],
        type: 'line',
        smooth: true
      }
    ]
  };

  // 使用刚指定的配置项和数据显示图表。
  myChart.setOption(option);
</script>
</body>
</html>
